import { Component, OnInit, ViewChild } from '@angular/core';
import { ColumnType, SPage, TablePageComponent } from '@shared/components/table-page/table-page.component';
import { Body, _HttpClient } from '@delon/theme';
import { NzMessageService, NzModalService } from 'ng-zorro-antd';
import { ApiService } from '@core/services/api';
import { STData } from '@delon/abc';
import { ACLService } from '@delon/acl';
import { type } from 'jquery';

@Component({
  selector: 'app-person-alarm',
  templateUrl: './person-alarm.component.html',
  styles: []
})
export class PersonAlarmComponent implements OnInit {
  @ViewChild('st', { static: false }) st: TablePageComponent;
  selectData: any[];
  loading = false;
  config: SPage = {
    columns: [
      {
        index: 'infoPeoplePhoto',
        title: '图片',
        width:80,
        type:ColumnType.img
      },
      {
        index: 'infoName',
        title: '用户名',
        width:100,
        filter: {
          placeholder: '请输入用户名称',
          type: 'string'
        }
      },
      {
        index: 'personType',
        title: '人员类型',
        width:100,
        // filter: {
        //   index:'infoSex',
        //   placeholder: '请选择性别',
        //   type: 'select',
        //   items: [
        //     {label: '未知的性别', value: 0},
        //     {label: '男', value: 1},
        //     {label: '女', value: 2},
        //     {label: '未说明的性别', value: 3}
        //   ]
        // }
      },
      {
        index: 'infoSex',
        title: '性别',
        width:100,
        type: ColumnType.tag,
        tag:{
          0:{text:'女'},
          1:{text:'男'},
          9:{text:'未说明的性别'}
        },
        filter: {
          index:'infoMobile',
          placeholder: '请输入手机号',
          type: 'string'
        }
     
      },
      {
        index: 'infoMobile',
        title: '联系电话',
        width:120,
        filter:{
          index:'areaCityName',
          placeholder: '请输入区域名称',
          type: 'string'
        }
      },
      {
        index:'areaCityName',
        title:'区域名称',
        width:450,
        filter:{
          index:'roomName',
          placeholder: '请输入房间名称',
          type: 'string'
        }
      },
      {
        index:'roomName',
        title:'房间名称',
        width:130,
        filter:{
          index:'eventName',
          placeholder:'请输入报警类型',
          type:'string'
        }
      },
      {
        index:'eventName',
        title:'报警类型',
        width:120,
        filter:{
          index:'eventProduceTime',
          placeholder:'开始时间',
          type:'date'
        }
      },
      {
        index:'eventProduceTime',
        title:'上报时间',
        width:120,
        filter:{
          index:'eventDisposeTime',
          placeholder:'结束时间',
          type:'date'
        }
      }
     
      
    ],
    showCheckBox: false,
    reqUrl:this.api.alarmManage.abnormalpage.url,
  }
  constructor(private http: _HttpClient,  private api: ApiService, private modal: NzModalService, private message: NzMessageService,private aclService: ACLService,) { }
  
  ngOnInit() {

  }

  _console(e: any): void {
    this.selectData = e;
  }

  dataProcess(data: STData[]){
    console.log(data);
    return data;
  }

}
